#!/bin/bash

export BASE_DATA_PATH=/home/mixagol/data
export CUR_DATA_DIR=${BASE_DATA_PATH}/2_raw_matrix_blast
export LC_ALL=C

export RESULTS_DIR=/home/mixagol/work/data/results_search_genes_in_genomes_04/
mkdir -p $RESULTS_DIR/output

2_raw_matrix/run_blast_cluster.sh $RESULTS_DIR/output/

cd $RESULTS_DIR
ls output/* | xargs zcat | gzip > results.txt.gz

rm -rf output

mv results.txt.gz $CUR_DATA_DIR/
cd $CUR_DATA_DIR
cat results.txt.gz | gunzip | awk -F'\t' '$11<0.05' \
    | ~/coreutils-8.13/src/sort -t$'\t' -S2G -T . -k2,2 | gzip \
    > results_0.05_sorted.txt.gz

